package wxdb.metadata;

import wxdb.index.btree.BTreeIndex;
import wxdb.record.TableInfo;

public class MetadataMgr {
	private static DbInfoMgr dbmgr;
	private static TableMgr tblmgr;
	private static IndexInfoMgr idxmgr;
	
	public MetadataMgr(){
		dbmgr = new DbInfoMgr();
		tblmgr = new TableMgr();
		idxmgr = new IndexInfoMgr();
	}
	
	public DbInfo getDbInfo(int dbid){
		return DbInfoMgr.getMeta(dbid);
	}
	
	public void writeDbInfo(int dbid, int tableNum){
		DbInfoMgr.writeMeta(dbid, tableNum);
	}
	
	public TableInfo getTableInfo(int dbid, String tableName){
		return TableMgr.getMeta(dbid, tableName);
	}
	
	public void writeTableInfo(int dbid, String tableName, TableInfo ti){
		TableMgr.writeMeta(dbid, tableName, ti);
	}

	public BTreeIndex getIndexInfo(int dbid, String tableName, String fldName){
		return IndexInfoMgr.getIndexInfo(dbid, tableName, fldName);
	}
	
	public void writeIndexInfo(int dbid, String tableName, String fldName, BTreeIndex index){
		IndexInfoMgr.writeIndexInfo(dbid, tableName, fldName, index);
	}

}
